<?php
require_once("vcl/vcl.inc.php");
require_once("lib/db_connection.php");
require_once("lib/my_library.php");
//Includes
use_unit("comctrls.inc.php");
use_unit("platinumgrid/jtplatinumgrid.inc.php");
use_unit("components4phpfull/jtdivwindow.inc.php");
use_unit("components4phpfull/jtgroupbox.inc.php");
use_unit("components4phpfull/jtjavascript.inc.php");
use_unit("components4phpfull/jtdatepicker.inc.php");
use_unit("components4phpfull/jtdatetimepicker.inc.php");
use_unit("components4phpfull/jtsitetheme.inc.php");
use_unit("forms.inc.php");
use_unit("extctrls.inc.php");
use_unit("stdctrls.inc.php");

//Class definition
class Veh_Reminder extends Page
{
       public $COMPLETION_TYPE = null;
       public $cmbDaysMos = null;
       public $edRemind = null;
       public $Label6 = null;
       public $Label4 = null;
       public $cmbdm = null;
       public $ednum = null;
       public $lblkm = null;
       public $edEvery = null;
       public $chkRec = null;
       public $lblEvery = null;
       public $imgBack = null;
       public $Button1 = null;
       public $hftrack = null;
       public $lblhr = null;
       public $dpDue1 = null;
       public $dpDue2 = null;
       public $btnCancel = null;
       public $btnSubmit = null;
       public $JTDivType = null;
       public $JTGroupBox1 = null;
       public $btnAddType = null;
       public $btnDelType = null;
       public $edType = null;
       public $listType = null;
       public $btnShowType = null;
       public $JTJavaScript3 = null;
       public $JTJavaScript2 = null;
       public $JTJavaScript1 = null;
       public $compid = null;
       public $edDesc = null;
       public $cmbcompletion = null;
       public $Label3 = null;
       public $edPrice = null;
       public $lblFixedPrice = null;
       public $Image3 = null;
       public $hiddenId = null;
       public $lblDueat = null;
       public $lblOrby = null;
       public $lblDueby = null;
       public $JTSiteTheme1 = null;
       public $lblHours = null;
       public $cmbVendor = null;
       public $memoComments = null;
       public $lblComments = null;
       public $Label2 = null;
       public $cmbType = null;
       public $lblType = null;
       public $Label5 = null;
       public $edDue = null;
       public $cmbSchedule = null;
       public $Label1 = null;
       function chkRecJSChange($sender, $params)
       {

       ?>
       var chk = document.getElementById('chkRec').checked;
       if(chk==true)
       {
       document.getElementById('edEvery_outer').style.visibility='visible';
       document.getElementById('lblEvery_outer').style.visibility='visible';
       document.getElementById('lblkm_outer').style.visibility='visible';

       var track = document.getElementById('cmbSchedule').value;
       var hr = document.getElementById('lblhr_outer');
       var km = document.getElementById('lblHours_outer');
       var dueat = document.getElementById('lblDueat_outer');
       var dueby = document.getElementById('lblDueby_outer');
       var every = document.getElementById('lblEvery_outer');
       var ednum = document.getElementById('ednum_outer');
       var dm = document.getElementById('cmbdm_outer');
       if(track=='Date')
       {
       //alert('date');
       document.getElementById('lblDueby').style.visibility = 'visible';
       document.getElementById('f-calendar-field-1').style.visibility = 'visible';
       document.getElementById('edDue_outer').style.visibility = 'hidden';
       document.getElementById('f-calendar-field-2').style.visibility = 'hidden';
       document.getElementById('lblOrby').style.visibility = 'hidden';
       document.getElementById('lblDueat').style.visibility = 'hidden';
       document.getElementById('lblhr').style.visibility = 'hidden';
       document.getElementById('lblHours').style.visibility = 'hidden';
       document.getElementById('f-calendar-trigger-2').style.visibility = 'hidden';
       document.getElementById('f-calendar-trigger-1').style.visibility = 'visible';
       document.getElementById('ednum_outer').style.visibility='visible';
       document.getElementById('cmbdm_outer').style.visibility='visible';
       document.getElementById('lblEvery_outer').style.visibility='visible';
       document.getElementById('edEvery_outer').style.visibility='hidden';
       document.getElementById('lblkm_outer').style.visibility='hidden';
       hr.style.left = '224px';
       km.style.left = '224px';
       dueat.style.left = '150px';
       dueby.style.left = '56px';
       every.style.left = '334px';
       ednum.style.left = '392px';
       dm.style.left = '472px';
       }

       if(track=='Mileage')
       {
       //alert('mileage');
       document.getElementById('lblDueby').style.visibility = 'hidden';
       document.getElementById('f-calendar-field-1').style.visibility = 'hidden';
       document.getElementById('edDue_outer').style.visibility = 'visible';
       document.getElementById('f-calendar-field-2').style.visibility = 'hidden';
       document.getElementById('lblOrby').style.visibility = 'hidden';
       document.getElementById('lblDueat').style.visibility = 'visible';
       document.getElementById('lblhr').style.visibility = 'hidden';
       document.getElementById('lblHours').style.visibility = 'visible';
       document.getElementById('f-calendar-trigger-2').style.visibility = 'hidden';
       document.getElementById('f-calendar-trigger-1').style.visibility = 'hidden';
       document.getElementById('ednum_outer').style.visibility='hidden';
       document.getElementById('cmbdm_outer').style.visibility='hidden';
       document.getElementById('lblEvery_outer').style.visibility='visible';
       document.getElementById('edEvery_outer').style.visibility='visible';
       document.getElementById('lblkm_outer').style.visibility='visible';
       document.getElementById('lblkm').innerHTML="Km";
       hr.style.left = '224px';
       km.style.left = '334px';
       dueat.style.left = '56px';
       dueby.style.left = '150px';
       every.style.left = '381px';
       ednum.style.left = '670px';
       dm.style.left = '750px';
       }

       if(track=='Hours')
       {
       //alert('hours');
       document.getElementById('lblDueby').style.visibility = 'hidden';
       document.getElementById('f-calendar-field-1').style.visibility = 'hidden';
       document.getElementById('edDue_outer').style.visibility = 'visible';
       document.getElementById('f-calendar-field-2').style.visibility = 'hidden';
       document.getElementById('lblOrby').style.visibility = 'hidden';
       document.getElementById('lblDueat').style.visibility = 'visible';
       document.getElementById('lblhr').style.visibility = 'visible';
       document.getElementById('lblHours').style.visibility = 'visible';
       document.getElementById('f-calendar-trigger-2').style.visibility = 'hidden';
       document.getElementById('f-calendar-trigger-1').style.visibility = 'hidden';
       document.getElementById('ednum_outer').style.visibility='hidden';
       document.getElementById('cmbdm_outer').style.visibility='hidden';
       document.getElementById('lblEvery_outer').style.visibility='visible';
       document.getElementById('edEvery_outer').style.visibility='visible';
       document.getElementById('lblkm_outer').style.visibility='visible';
       document.getElementById('lblkm').innerHTML="Hours";
       hr.style.left = '334px';
       km.style.left = '224px';
       dueat.style.left = '56px';
       dueby.style.left = '150px';
       every.style.left = '381px';
       ednum.style.left = '670px';
       dm.style.left = '750px';
       }
       }
       if(chk==false)
       {
       document.getElementById('edEvery_outer').style.visibility='hidden';
       document.getElementById('lblEvery_outer').style.visibility='hidden';
       document.getElementById('lblkm_outer').style.visibility='hidden';
       document.getElementById('ednum_outer').style.visibility='hidden';
       document.getElementById('cmbdm_outer').style.visibility='hidden';

       var track = document.getElementById('cmbSchedule').value;
       var hr = document.getElementById('lblhr_outer');
       var km = document.getElementById('lblHours_outer');
       var dueat = document.getElementById('lblDueat_outer');
       var dueby = document.getElementById('lblDueby_outer');

       if(track=='Date')
       {
       //alert('date');
       document.getElementById('lblDueby').style.visibility = 'visible';
       document.getElementById('f-calendar-field-1').style.visibility = 'visible';
       document.getElementById('edDue_outer').style.visibility = 'hidden';
       document.getElementById('f-calendar-field-2').style.visibility = 'hidden';
       document.getElementById('lblOrby').style.visibility = 'hidden';
       document.getElementById('lblDueat').style.visibility = 'hidden';
       document.getElementById('lblhr').style.visibility = 'hidden';
       document.getElementById('lblHours').style.visibility = 'hidden';
       document.getElementById('f-calendar-trigger-2').style.visibility = 'hidden';
       document.getElementById('f-calendar-trigger-1').style.visibility = 'visible';
       hr.style.left = '224px';
       km.style.left = '224px';
       dueat.style.left = '150px';
       dueby.style.left = '56px';
       }

       if(track=='Mileage')
       {
       //alert('mileage');
       document.getElementById('lblDueby').style.visibility = 'hidden';
       document.getElementById('f-calendar-field-1').style.visibility = 'hidden';
       document.getElementById('edDue_outer').style.visibility = 'visible';
       document.getElementById('f-calendar-field-2').style.visibility = 'hidden';
       document.getElementById('lblOrby').style.visibility = 'hidden';
       document.getElementById('lblDueat').style.visibility = 'visible';
       document.getElementById('lblhr').style.visibility = 'hidden';
       document.getElementById('lblHours').style.visibility = 'visible';
       document.getElementById('f-calendar-trigger-2').style.visibility = 'hidden';
       document.getElementById('f-calendar-trigger-1').style.visibility = 'hidden';
       hr.style.left = '224px';
       km.style.left = '334px';
       dueat.style.left = '56px';
       dueby.style.left = '150px';
       }

       if(track=='Hours')
       {
       //alert('hours');
       document.getElementById('lblDueby').style.visibility = 'hidden';
       document.getElementById('f-calendar-field-1').style.visibility = 'hidden';
       document.getElementById('edDue_outer').style.visibility = 'visible';
       document.getElementById('f-calendar-field-2').style.visibility = 'hidden';
       document.getElementById('lblOrby').style.visibility = 'hidden';
       document.getElementById('lblDueat').style.visibility = 'visible';
       document.getElementById('lblhr').style.visibility = 'visible';
       document.getElementById('lblHours').style.visibility = 'visible';
       document.getElementById('f-calendar-trigger-2').style.visibility = 'hidden';
       document.getElementById('f-calendar-trigger-1').style.visibility = 'hidden';
       hr.style.left = '334px';
       km.style.left = '224px';
       dueat.style.left = '56px';
       dueby.style.left = '150px';
       }
       }
       <?php

       }

       function imgBackJSMouseOut($sender, $params)
       {

       ?>
       //Add your javascript code here
       document.images['imgBack'].src="image/btn_back.png"
       <?php

       }

       function imgBackJSMouseOver($sender, $params)
       {

       ?>
       //Add your javascript code here
       document.images['imgBack'].src="image/btn_back2.png"
       <?php

       }

       function Button1JSClick($sender, $params)
       {

       ?>
       document.getElementById('lblhr_outer').style.visibility = 'visible';

       <?php

       }

       function Veh_ReminderJSLoad($sender, $params)
       {

       ?>
       //Add your javascript code here
       var chk = document.getElementById('chkRec').checked;
       if(chk==true)
       {
       document.getElementById('edEvery_outer').style.visibility='visible';
       document.getElementById('lblEvery_outer').style.visibility='visible';
       document.getElementById('lblkm_outer').style.visibility='visible';

       var track = document.getElementById('cmbSchedule').value;
       var hr = document.getElementById('lblhr_outer');
       var km = document.getElementById('lblHours_outer');
       var dueat = document.getElementById('lblDueat_outer');
       var dueby = document.getElementById('lblDueby_outer');
       var every = document.getElementById('lblEvery_outer');
       var ednum = document.getElementById('ednum_outer');
       var dm = document.getElementById('cmbdm_outer');
       if(track=='Date')
       {
       //alert('date');
       document.getElementById('lblDueby').style.visibility = 'visible';
       document.getElementById('f-calendar-field-1').style.visibility = 'visible';
       document.getElementById('edDue_outer').style.visibility = 'hidden';
       document.getElementById('f-calendar-field-2').style.visibility = 'hidden';
       document.getElementById('lblOrby').style.visibility = 'hidden';
       document.getElementById('lblDueat').style.visibility = 'hidden';
       document.getElementById('lblhr').style.visibility = 'hidden';
       document.getElementById('lblHours').style.visibility = 'hidden';
       document.getElementById('f-calendar-trigger-2').style.visibility = 'hidden';
       document.getElementById('f-calendar-trigger-1').style.visibility = 'visible';
       document.getElementById('ednum_outer').style.visibility='visible';
       document.getElementById('cmbdm_outer').style.visibility='visible';
       document.getElementById('lblEvery_outer').style.visibility='visible';
       document.getElementById('edEvery_outer').style.visibility='hidden';
       document.getElementById('lblkm_outer').style.visibility='hidden';
       hr.style.left = '224px';
       km.style.left = '224px';
       dueat.style.left = '150px';
       dueby.style.left = '56px';
       every.style.left = '334px';
       ednum.style.left = '392px';
       dm.style.left = '472px';
       }

       if(track=='Mileage')
       {
       //alert('mileage');
       document.getElementById('lblDueby').style.visibility = 'hidden';
       document.getElementById('f-calendar-field-1').style.visibility = 'hidden';
       document.getElementById('edDue_outer').style.visibility = 'visible';
       document.getElementById('f-calendar-field-2').style.visibility = 'hidden';
       document.getElementById('lblOrby').style.visibility = 'hidden';
       document.getElementById('lblDueat').style.visibility = 'visible';
       document.getElementById('lblhr').style.visibility = 'hidden';
       document.getElementById('lblHours').style.visibility = 'visible';
       document.getElementById('f-calendar-trigger-2').style.visibility = 'hidden';
       document.getElementById('f-calendar-trigger-1').style.visibility = 'hidden';
       document.getElementById('ednum_outer').style.visibility='hidden';
       document.getElementById('cmbdm_outer').style.visibility='hidden';
       document.getElementById('lblEvery_outer').style.visibility='visible';
       document.getElementById('edEvery_outer').style.visibility='visible';
       document.getElementById('lblkm_outer').style.visibility='visible';
       document.getElementById('lblkm').innerHTML="Km";
       hr.style.left = '224px';
       km.style.left = '334px';
       dueat.style.left = '56px';
       dueby.style.left = '150px';
       every.style.left = '381px';
       ednum.style.left = '670px';
       dm.style.left = '750px';
       }

       if(track=='Hours')
       {
       //alert('hours');
       document.getElementById('lblDueby').style.visibility = 'hidden';
       document.getElementById('f-calendar-field-1').style.visibility = 'hidden';
       document.getElementById('edDue_outer').style.visibility = 'visible';
       document.getElementById('f-calendar-field-2').style.visibility = 'hidden';
       document.getElementById('lblOrby').style.visibility = 'hidden';
       document.getElementById('lblDueat').style.visibility = 'visible';
       document.getElementById('lblhr').style.visibility = 'visible';
       document.getElementById('lblHours').style.visibility = 'visible';
       document.getElementById('f-calendar-trigger-2').style.visibility = 'hidden';
       document.getElementById('f-calendar-trigger-1').style.visibility = 'hidden';
       document.getElementById('ednum_outer').style.visibility='hidden';
       document.getElementById('cmbdm_outer').style.visibility='hidden';
       document.getElementById('lblEvery_outer').style.visibility='visible';
       document.getElementById('edEvery_outer').style.visibility='visible';
       document.getElementById('lblkm_outer').style.visibility='visible';
       document.getElementById('lblkm').innerHTML="Hours";
       hr.style.left = '334px';
       km.style.left = '224px';
       dueat.style.left = '56px';
       dueby.style.left = '150px';
       every.style.left = '381px';
       ednum.style.left = '670px';
       dm.style.left = '750px';
       }
       }
       if(chk==false)
       {
       document.getElementById('edEvery_outer').style.visibility='hidden';
       document.getElementById('lblEvery_outer').style.visibility='hidden';
       document.getElementById('lblkm_outer').style.visibility='hidden';
       document.getElementById('ednum_outer').style.visibility='hidden';
       document.getElementById('cmbdm_outer').style.visibility='hidden';

       var track = document.getElementById('cmbSchedule').value;
       var hr = document.getElementById('lblhr_outer');
       var km = document.getElementById('lblHours_outer');
       var dueat = document.getElementById('lblDueat_outer');
       var dueby = document.getElementById('lblDueby_outer');

       if(track=='Date')
       {
       //alert('date');
       document.getElementById('lblDueby').style.visibility = 'visible';
       document.getElementById('f-calendar-field-1').style.visibility = 'visible';
       document.getElementById('edDue_outer').style.visibility = 'hidden';
       document.getElementById('f-calendar-field-2').style.visibility = 'hidden';
       document.getElementById('lblOrby').style.visibility = 'hidden';
       document.getElementById('lblDueat').style.visibility = 'hidden';
       document.getElementById('lblhr').style.visibility = 'hidden';
       document.getElementById('lblHours').style.visibility = 'hidden';
       document.getElementById('f-calendar-trigger-2').style.visibility = 'hidden';
       document.getElementById('f-calendar-trigger-1').style.visibility = 'visible';
       hr.style.left = '224px';
       km.style.left = '224px';
       dueat.style.left = '150px';
       dueby.style.left = '56px';
       }

       if(track=='Mileage')
       {
       //alert('mileage');
       document.getElementById('lblDueby').style.visibility = 'hidden';
       document.getElementById('f-calendar-field-1').style.visibility = 'hidden';
       document.getElementById('edDue_outer').style.visibility = 'visible';
       document.getElementById('f-calendar-field-2').style.visibility = 'hidden';
       document.getElementById('lblOrby').style.visibility = 'hidden';
       document.getElementById('lblDueat').style.visibility = 'visible';
       document.getElementById('lblhr').style.visibility = 'hidden';
       document.getElementById('lblHours').style.visibility = 'visible';
       document.getElementById('f-calendar-trigger-2').style.visibility = 'hidden';
       document.getElementById('f-calendar-trigger-1').style.visibility = 'hidden';
       hr.style.left = '224px';
       km.style.left = '334px';
       dueat.style.left = '56px';
       dueby.style.left = '150px';
       }

       if(track=='Hours')
       {
       //alert('hours');
       document.getElementById('lblDueby').style.visibility = 'hidden';
       document.getElementById('f-calendar-field-1').style.visibility = 'hidden';
       document.getElementById('edDue_outer').style.visibility = 'visible';
       document.getElementById('f-calendar-field-2').style.visibility = 'hidden';
       document.getElementById('lblOrby').style.visibility = 'hidden';
       document.getElementById('lblDueat').style.visibility = 'visible';
       document.getElementById('lblhr').style.visibility = 'visible';
       document.getElementById('lblHours').style.visibility = 'visible';
       document.getElementById('f-calendar-trigger-2').style.visibility = 'hidden';
       document.getElementById('f-calendar-trigger-1').style.visibility = 'hidden';
       hr.style.left = '334px';
       km.style.left = '224px';
       dueat.style.left = '56px';
       dueby.style.left = '150px';
       }
       }
       <?php

       }

       function cmbScheduleJSChange($sender, $params)
       {

       ?>
       //Add your javascript code here
       var chk = document.getElementById('chkRec').checked;
       if(chk==true)
       {
       document.getElementById('edEvery_outer').style.visibility='visible';
       document.getElementById('lblEvery_outer').style.visibility='visible';
       document.getElementById('lblkm_outer').style.visibility='visible';

       var track = document.getElementById('cmbSchedule').value;
       var hr = document.getElementById('lblhr_outer');
       var km = document.getElementById('lblHours_outer');
       var dueat = document.getElementById('lblDueat_outer');
       var dueby = document.getElementById('lblDueby_outer');
       var every = document.getElementById('lblEvery_outer');
       var ednum = document.getElementById('ednum_outer');
       var dm = document.getElementById('cmbdm_outer');
       if(track=='Date')
       {
       //alert('date');
       document.getElementById('lblDueby').style.visibility = 'visible';
       document.getElementById('f-calendar-field-1').style.visibility = 'visible';
       document.getElementById('edDue_outer').style.visibility = 'hidden';
       document.getElementById('f-calendar-field-2').style.visibility = 'hidden';
       document.getElementById('lblOrby').style.visibility = 'hidden';
       document.getElementById('lblDueat').style.visibility = 'hidden';
       document.getElementById('lblhr').style.visibility = 'hidden';
       document.getElementById('lblHours').style.visibility = 'hidden';
       document.getElementById('f-calendar-trigger-2').style.visibility = 'hidden';
       document.getElementById('f-calendar-trigger-1').style.visibility = 'visible';
       document.getElementById('ednum_outer').style.visibility='visible';
       document.getElementById('cmbdm_outer').style.visibility='visible';
       document.getElementById('lblEvery_outer').style.visibility='visible';
       document.getElementById('edEvery_outer').style.visibility='hidden';
       document.getElementById('lblkm_outer').style.visibility='hidden';
       hr.style.left = '224px';
       km.style.left = '224px';
       dueat.style.left = '150px';
       dueby.style.left = '56px';
       every.style.left = '334px';
       ednum.style.left = '392px';
       dm.style.left = '472px';
       }

       if(track=='Mileage')
       {
       //alert('mileage');
       document.getElementById('lblDueby').style.visibility = 'hidden';
       document.getElementById('f-calendar-field-1').style.visibility = 'hidden';
       document.getElementById('edDue_outer').style.visibility = 'visible';
       document.getElementById('f-calendar-field-2').style.visibility = 'hidden';
       document.getElementById('lblOrby').style.visibility = 'hidden';
       document.getElementById('lblDueat').style.visibility = 'visible';
       document.getElementById('lblhr').style.visibility = 'hidden';
       document.getElementById('lblHours').style.visibility = 'visible';
       document.getElementById('f-calendar-trigger-2').style.visibility = 'hidden';
       document.getElementById('f-calendar-trigger-1').style.visibility = 'hidden';
       document.getElementById('ednum_outer').style.visibility='hidden';
       document.getElementById('cmbdm_outer').style.visibility='hidden';
       document.getElementById('lblEvery_outer').style.visibility='visible';
       document.getElementById('edEvery_outer').style.visibility='visible';
       document.getElementById('lblkm_outer').style.visibility='visible';
       document.getElementById('lblkm').innerHTML="Km";
       hr.style.left = '224px';
       km.style.left = '334px';
       dueat.style.left = '56px';
       dueby.style.left = '150px';
       every.style.left = '381px';
       ednum.style.left = '670px';
       dm.style.left = '750px';
       }

       if(track=='Hours')
       {
       //alert('hours');
       document.getElementById('lblDueby').style.visibility = 'hidden';
       document.getElementById('f-calendar-field-1').style.visibility = 'hidden';
       document.getElementById('edDue_outer').style.visibility = 'visible';
       document.getElementById('f-calendar-field-2').style.visibility = 'hidden';
       document.getElementById('lblOrby').style.visibility = 'hidden';
       document.getElementById('lblDueat').style.visibility = 'visible';
       document.getElementById('lblhr').style.visibility = 'visible';
       document.getElementById('lblHours').style.visibility = 'visible';
       document.getElementById('f-calendar-trigger-2').style.visibility = 'hidden';
       document.getElementById('f-calendar-trigger-1').style.visibility = 'hidden';
       document.getElementById('ednum_outer').style.visibility='hidden';
       document.getElementById('cmbdm_outer').style.visibility='hidden';
       document.getElementById('lblEvery_outer').style.visibility='visible';
       document.getElementById('edEvery_outer').style.visibility='visible';
       document.getElementById('lblkm_outer').style.visibility='visible';
       document.getElementById('lblkm').innerHTML="Hours";
       hr.style.left = '334px';
       km.style.left = '224px';
       dueat.style.left = '56px';
       dueby.style.left = '150px';
       every.style.left = '381px';
       ednum.style.left = '670px';
       dm.style.left = '750px';
       }
       }
       if(chk==false)
       {
       document.getElementById('edEvery_outer').style.visibility='hidden';
       document.getElementById('lblEvery_outer').style.visibility='hidden';
       document.getElementById('lblkm_outer').style.visibility='hidden';
       document.getElementById('ednum_outer').style.visibility='hidden';
       document.getElementById('cmbdm_outer').style.visibility='hidden';

       var track = document.getElementById('cmbSchedule').value;
       var hr = document.getElementById('lblhr_outer');
       var km = document.getElementById('lblHours_outer');
       var dueat = document.getElementById('lblDueat_outer');
       var dueby = document.getElementById('lblDueby_outer');

       if(track=='Date')
       {
       //alert('date');
       document.getElementById('lblDueby').style.visibility = 'visible';
       document.getElementById('f-calendar-field-1').style.visibility = 'visible';
       document.getElementById('edDue_outer').style.visibility = 'hidden';
       document.getElementById('f-calendar-field-2').style.visibility = 'hidden';
       document.getElementById('lblOrby').style.visibility = 'hidden';
       document.getElementById('lblDueat').style.visibility = 'hidden';
       document.getElementById('lblhr').style.visibility = 'hidden';
       document.getElementById('lblHours').style.visibility = 'hidden';
       document.getElementById('f-calendar-trigger-2').style.visibility = 'hidden';
       document.getElementById('f-calendar-trigger-1').style.visibility = 'visible';
       hr.style.left = '224px';
       km.style.left = '224px';
       dueat.style.left = '150px';
       dueby.style.left = '56px';
       }

       if(track=='Mileage')
       {
       //alert('mileage');
       document.getElementById('lblDueby').style.visibility = 'hidden';
       document.getElementById('f-calendar-field-1').style.visibility = 'hidden';
       document.getElementById('edDue_outer').style.visibility = 'visible';
       document.getElementById('f-calendar-field-2').style.visibility = 'hidden';
       document.getElementById('lblOrby').style.visibility = 'hidden';
       document.getElementById('lblDueat').style.visibility = 'visible';
       document.getElementById('lblhr').style.visibility = 'hidden';
       document.getElementById('lblHours').style.visibility = 'visible';
       document.getElementById('f-calendar-trigger-2').style.visibility = 'hidden';
       document.getElementById('f-calendar-trigger-1').style.visibility = 'hidden';
       hr.style.left = '224px';
       km.style.left = '334px';
       dueat.style.left = '56px';
       dueby.style.left = '150px';
       }

       if(track=='Hours')
       {
       //alert('hours');
       document.getElementById('lblDueby').style.visibility = 'hidden';
       document.getElementById('f-calendar-field-1').style.visibility = 'hidden';
       document.getElementById('edDue_outer').style.visibility = 'visible';
       document.getElementById('f-calendar-field-2').style.visibility = 'hidden';
       document.getElementById('lblOrby').style.visibility = 'hidden';
       document.getElementById('lblDueat').style.visibility = 'visible';
       document.getElementById('lblhr').style.visibility = 'visible';
       document.getElementById('lblHours').style.visibility = 'visible';
       document.getElementById('f-calendar-trigger-2').style.visibility = 'hidden';
       document.getElementById('f-calendar-trigger-1').style.visibility = 'hidden';
       hr.style.left = '334px';
       km.style.left = '224px';
       dueat.style.left = '56px';
       dueby.style.left = '150px';
       }
       }
       <?php

       }



       function btnDelTypeJSClick($sender, $params)
       {

       ?>
       //Add your javascript code here
       var TypeIndex = document.getElementById('listType').selectedIndex;
       var TypeValue = document.getElementById('listType')[TypeIndex].value;
       var compider3 = document.getElementById('compid').value;
       AjaxType3(TypeValue,compider3);
       <?php

       }

       function btnAddTypeJSClick($sender, $params)
       {

       ?>
       //Add your javascript code here
       var addtype = document.getElementById('edType').value;
       var compider = document.getElementById('compid').value;
       AjaxType2(addtype,compider);
       document.Veh_Reminder.edType.value = " "
       <?php

       }

       function btnShowTypeJSClick($sender, $params)
       {

       ?>
       //Add your javascript code here
       document.getElementById('JTDivType').Show();
       <?php

       }

       function cmbcompletionJSChange($sender, $params)
       {
       //echo $this->cmbcompletion->ajaxCall('CompletionChange');
       ?>
       completionWindow();
       return false;
       <?php

       }


       function btnCancelClick($sender, $params)
       {
       redirect('veh_reminder_list.php?veh='.$this->hiddenId->getValue());


       }


       function CompletionChange()
       {
       $completion = $this->cmbcompletion->getItemIndex();

       if($completion=="WorkOrder")
       {
        $this->cmbType->Clear();
        $result_type = mysql_query("select * from lookup_workorder_tbl where company_id='".$_SESSION['company_id']."' and category='type'");

          while($row_type = mysql_fetch_array($result_type))
          {
            $this->cmbType->AddItem($row_type['value'], null, $row_type['value']);
          }
       }

       if($completion=="Payment")
       {
        $this->cmbType->Clear();
        $result_type = mysql_query("select * from lookup_expense_tbl where company_id='".$_SESSION['company_id']."' and category='types'");

          while($row_type = mysql_fetch_array($result_type))
          {
            $this->cmbType->AddItem($row_type['value'], null, $row_type['value']);
          }
       }

       if($completion=="None")
       {
        $this->cmbType->Clear();
        $result_type = mysql_query("select * from lookup_expense_tbl where company_id='".$_SESSION['company_id']."' and category='types'");

          while($row_type = mysql_fetch_array($result_type))
          {
            $this->cmbType->AddItem($row_type['value'], null, $row_type['value']);
          }
       }

       return false;
       }


       function Veh_ReminderCreate($sender, $params)
       {
       //echo "<script type=text/javascript>alert('sss');</script>";
       /*$current_date = date("Y/m/d");
       $input_date = $this->dpDue1->getDate();

       $check_date = new my_library();

       $this->stat->Caption=$check_date->daysDifference('2009/10/26', $current_date);*/
       $this->imgBack->setLink('veh_reminder_list.php?veh='.$this->hiddenId->getValue());


       $this->compid->Value = $_SESSION['company_id'];
       $veh_id = $_GET['veh'];
       if($veh_id!='' && $veh_id!=null)
       $this->hiddenId->setValue($veh_id);

       $this->dpDue->Text=date('Y-m-d');
       $this->edDesc->Text='';
       $this->edDue->Text='';

       $result_veh = mysql_query("select * from vehicle_tbl where vehicle_id='".$this->hiddenId->getValue()."'");
       $row_veh = mysql_fetch_array($result_veh);
       $track = $row_veh['track_by'];
       $this->hftrack->setValue($track);

       //$this->cmbSchedule->AddItem('Mileage', null, 'Mileage');
       //$this->cmbSchedule->AddItem('Hours', null, 'Hours');
       if($track=='distance')
       {
       $this->cmbSchedule->AddItem('Mileage', null, 'Mileage');
       $this->cmbSchedule->ItemIndex = 'Mileage';
       }

       if($track=='hours')
       {
       $this->cmbSchedule->AddItem('Hours', null, 'Hours');
       $this->cmbSchedule->ItemIndex = 'Hours';
       }

       //$this->cmbSchedule->AddItem('Hours', null, 'Hours');
       //$this->cmbSchedule->AddItem('Mileage', null, 'Mileage');
       //start sched by


       /*$this->cmbType->Clear();
       $result_type = mysql_query("select * from lookup_workorder_tbl where company_id='".$_SESSION['company_id']."' AND category='type'");

        while($row_type = mysql_fetch_array($result_type))
        {
            $this->cmbType->AddItem($row_type['value'], null, $row_type['value']);
        }*/

       //list Type
       $this->listType->Clear();
       $result_t = mysql_query("select * from lookup_workorder_tbl where company_id='".$_SESSION['company_id']."' AND category='type'");

        while($row_t = mysql_fetch_array($result_t))
        {
        $this->listType->AddItem($row_t['value'], null, $row_t['value']);
        }


       /*$this->cmbDesc->Clear();
       $result_desc = mysql_query("select * from lookup_workorder_tbl where category='task descriptions'");

        while($row_desc = mysql_fetch_array($result_desc))
        {
            $this->cmbDesc->AddItem($row_desc['value'], null, $row_desc['value']);
        }*/

       $this->cmbVendor->Clear();
       $result_vendor = mysql_query("select vendor_name from vendor_tbl where company_id='".$_SESSION['company_id']."'");

        while($row_vendor = mysql_fetch_array($result_vendor))
        {
            $this->cmbVendor->AddItem($row_vendor['vendor_name'], null, $row_vendor['vendor_name']);
        }

       }

       function btnSubmitClick($sender, $params)
       {
       $current_date = date("Y-m-d");
       $cmb_sched = $this->cmbSchedule->getItemIndex();

       $sched = $cmb_sched;
       /*if($sched=='Date')
       {
       $input_date = $this->dpDue2->getText();
       }
       else
       {
       $input_date = $this->dpDue1->getText();
       }*/
       //die($input_date);
       $input_date = $this->dpDue->getText();

       if($cmb_sched!='Hours' || $cmb_sched!='Mileage' || $input_date!=null || $input_date!='')
       {
       $check_date = new my_library();
       $days_computed = $check_date->daysDifference($input_date, $current_date);
       if($days_computed<=0)
       {
       $status = 'Due';
       }
       else if($days_computed<=10 && $days_computed!=0)
       {
       $status = 'Warning';
       }
       }

       $hours_save = null;
       $date_save = null;
       if($cmb_sched=='Time')
       {
       $date_save = $this->dpDue->getText();
       }
       if($cmb_sched=='Hours' || $cmb_sched=='Mileage')
       {
       $hours_save = $this->edDue->Text;
       }
       /*if($cmb_sched=='Both')
       {
       $hours_save = $this->edDue->Text;
       $date_save = $this->dpDue->getText();
       }*/



       if($cmb_sched=='Mileage' || $cmb_sched=='Hours')
       {
         $save_rem = "rem_usage,";
         $save_rem2 = "'".$this->edRemind->Text."',";
       }
       if($cmb_sched=='Time')
       {
         $save_rem = "rem_by,rem_time,";
         $save_rem2 = "'".$this->cmbDaysMos->getItemIndex()."','".$this->edRemind->Text."',";
       }

       if($this->chkRec->Checked == true)
       $recurring = '1';
       if($this->chkRec->Checked == false)
       $recurring = '0';

       if($recurring=='1')//recurring reminder per vehicle
       {
       mysql_query("insert into template_recurring_tbl (company_id,
       recurring,
       recur_veh_id,
       schedule_by,
       due_usage,
       due_time,
       due_by,
       usage_basis,
       date_basis,
       computed_date,
       ".$save_rem."
       completion_window,
       type,
       description,
       other_description,
       price,
       vendor,
       comments)

       values('".$_SESSION['company_id']."',
       '".$recurring."',
       '".$this->hiddenId->getValue()."'
       '".$this->cmbSchedule->getItemIndex()."',
       '".$hours_save."',
       '".$date_save."',
       '".$schedBy_save."',
       '".$this->edDue->Text."',
       '".$this->dpBasis->Text."',
       '".$due_date."',
       ".$save_rem2."
       '".$this->cmbcompletion->getItemIndex()."',
       '".$this->cmbType->getItemIndex()."',
       '".$this->edDescTemp->Text."',
       '".$this->edOthers->Text."',
       '".$this->edPrice->Text."',
       '".$this->cmbVendor->getItemIndex()."',
       '".$this->memoComments->Text."')")or die("INSERT REMINDER RECURRING- " . mysql_error());
       }
       if($recurring=='0')//non-recurring reminder per vehicle
       {
       mysql_query("insert into veh_reminder_tbl (company_id,
       vehicle_id,
       schedule_by,
       due_hours,
       due_date,
       ".$save_rem."
       completion_window,
       type,
       description,
       vendor,
       comments,
       status,
       status2)

       values('".$_SESSION['company_id']."',
       '".$this->hiddenId->getValue()."',
       '".$this->cmbSchedule->getItemIndex()."',
       '".$hours_save."',
       '".$date_save."',
       ".$save_rem2."
       '".$this->cmbcompletion->getItemIndex()."',
       '".$this->cmbType->getItemIndex()."',
       '".$this->edDesc->Text."',
       '".$this->cmbVendor->getItemIndex()."',
       '".$this->memoComments->Text."',
       '".$status."',
       '".Pending."')")or die("INSERT REMINDER - " . mysql_error());
       }
       redirect('veh_reminder_list.php?veh='.$this->hiddenId->getValue());
       }


}

global $application;

global $Veh_Reminder;

//Creates the form
$Veh_Reminder=new Veh_Reminder($application);

//Read from resource file
$Veh_Reminder->loadResource(__FILE__);

//Shows the form
$Veh_Reminder->show();

?>